#ifndef GENERALWIDGET_H
#define GENERALWIDGET_H

#include"ui_general.h"
#include<QValidator>

#include "serialize/general.h"
#include "serialize/skill.h"

namespace Ui{
class GeneralWidget;
}

class GeneralWidget : public QWidget
{
    Q_OBJECT

public:
    explicit GeneralWidget(QWidget* p=0);
    ~GeneralWidget();

    void initialMap();
    inline void setFilePath(QString s){filePath = s;}
    inline void setWorkPath(QString s){workPath = s;}
    General getGeneralFromUI();
    void displayGeneralToUI(General& g);
    General readGeneralFromFile();
    bool saveGeneralToFile();
    void clearUI();

    static void exportToBinary(QString workspacepath);
    static void exportToXML(QString workspacepath);
    static bool importFromXML(QString workspacepath,QString xmlFile);

    Ui::GeneralWidget* ui;

private slots:
    void s_cellChanged(int row,int col);
    void s_cellDoubleClicked(int row,int col);

private:
    QMap<int,QString> skillMap;
    QString filePath;
    QString workPath;
    void setInputMask();
};

#endif // GENERALWIDGET_H
